<template>
	<view class="page">
		<view class="head">
			
		</view>
		<view class="body">
			<!-- 热门职位开始 -->
			<view class="job-position-list">
				<HotJobs :hotJobsList="hotJobsList"></HotJobs>
				<u-loadmore :status="loadMoreStatus" loading-text="努力加载中..." loadmore-text="上拉加载" nomore-text="没有更多信息..." />
			</view>
			<!-- 热门职位结束 -->
		</view>
		<view class="bottom">
			<view style="height: 50rpx;"></view>
		</view>
		
		<!-- 自定义底部导航菜单开始 -->
		<JobTabbar :selectIndex="jobTabbarIndex"></JobTabbar>
		<!-- 自定义底部导航菜单结束 -->
		
	</view>
</template>

<script>
import JobTabbar from '@/components/JobTabbar/JobTabbar.vue';
import HotJobs from '@/components/HotJobs/HotJobs.vue';
	export default {
		data() {
			return {
				jobTabbarIndex: 4, //控制底部导航显示那个栏目激活状态
				hotJobsList: [], // 申请职位列表
				indexPage:  1, // 默认翻页
				indexAllPage: 1, //全部分页
				loadMoreStatus: 'loading', // 底部加载状态
			}
		},
		onLoad() {
			this.readOnLoad()
		},
		methods: {
			pageDataInit() {
				this.indexPage = 1 // 默认翻页
				this.indexAllPage = 1 //全部分页
				this.hotJobsList = [] // 热门职位列表
			},
			// 加载首页数据
			readOnLoad(){
				this.getJobMeJobHunterApplication()
			},
			getJobMeJobHunterApplication() {
				this.$api.getJobMeJobHunterApplication({openid: getApp().globalData.openid, page: this.indexPage})
				.then(res => {
					console.log(res.data)
					// this.hotJobsList = res.data.XXList
					console.log(res.data.XXList)
					let tempHotJobsList = []
					for (let jobItem of res.data.XXList) {
						jobItem.ID = jobItem.ZWID
						jobItem.ZPType = jobItem.Type
						tempHotJobsList.push(jobItem)
					}
					this.hotJobsList = tempHotJobsList
					if(this.hotJobsList.length < 6) {
						this.loadMoreStatus = 'nomore'
					}
					this.indexPage =  res.data.CurrentPage // 当前翻页
					this.indexAllPage =  res.data.Allpage //全部分页
				})
			}
		},
		components: {
			JobTabbar,
			HotJobs,
		}
	}
</script>

<style lang="scss" scoped>
@import url('jobApplyRecord.css');
</style>